//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System;
using Mindscape.BackgroundMotion.Website.Controllers;
using Mindscape.BackgroundMotion.Website.Infrastructure;
using Mindscape.BackgroundMotion.Website.Views;

namespace Mindscape.BackgroundMotion.Website
{
  public partial class Login : PageBase<LoginPresenter, ILoginView, IMembershipController>, ILoginView
  {
    /// <summary>
    /// Handles the Click event of the LoginButton control by authenticating the specified credentials
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void LoginButton_Click(object sender, EventArgs e)
    {
      Presenter.Authenticate(EmailAddress.Text.Trim(), Password.Text, RememberMe.Checked);
    }

    /// <summary>
    /// Conditionally show validation errors on the form
    /// </summary>
    public void ShowValidationError()
    {
      ValidationPanel.Visible = true;
    }
  }
}